package com.wsjj.yjh;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class UnionExample {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<Integer> ds1 = env.fromElements(1, 2, 3);
        DataStreamSource<Integer> ds2 = env.fromElements(10, 20, 30);
        DataStreamSource<String> ds3 = env.fromElements("4", "5", "8");
        DataStream<Integer> union = ds1.union(ds2, ds3.map(Integer::valueOf));
        union.print();
        env.execute();
    }
}
